package com.tripspins.app.bo;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by João.Rutkoski on 20/06/13.
 */
public class CurrentWeather implements Parcelable {
    private boolean isSynced;
    double cloudCover;
    double humidity;
    double precipMM;
    double pressure;
    double tempC;
    double tempF;
    double visibility;
    String weatherDesc;
    String weatherIconUrl;
    String windDir16Point;
    int windDirDegree;
    double windSpeedKmph;
    double windspeedMiles;


    public CurrentWeather(){isSynced = false;


    }
    public boolean isSynced() {
        return isSynced;
    }

    public void setSynced(boolean synced) {
        isSynced = synced;
    }

    @Override
    public String toString()
    {
        return weatherDesc;
    }

    public double getCloudCover() {
        return cloudCover;
    }

    public void setCloudCover(double cloudCover) {
        this.cloudCover = cloudCover;
    }

    public double getHumidity() {
        return humidity;
    }

    public void setHumidity(double humidity) {
        this.humidity = humidity;
    }

    public double getPrecipMM() {
        return precipMM;
    }

    public void setPrecipMM(double precipMM) {
        this.precipMM = precipMM;
    }

    public double getPressure() {
        return pressure;
    }

    public void setPressure(double pressure) {
        this.pressure = pressure;
    }

    public double getTempC() {
        return tempC;
    }

    public void setTempC(double tempC) {
        this.tempC = tempC;
    }

    public double getTempF() {
        return tempF;
    }

    public void setTempF(double tempF) {
        this.tempF = tempF;
    }

    public double getVisibility() {
        return visibility;
    }

    public void setVisibility(double visibility) {
        this.visibility = visibility;
    }

    public String getWeatherDesc() {
        return weatherDesc;
    }

    public void setWeatherDesc(String weatherDesc) {
        this.weatherDesc = weatherDesc;
    }

    public String getWeatherIconUrl() {
        return weatherIconUrl;
    }

    public void setWeatherIconUrl(String weatherIconUrl) {
        this.weatherIconUrl = weatherIconUrl;
    }

    public String getWindDir16Point() {
        return windDir16Point;
    }

    public void setWindDir16Point(String windDir16Point) {
        this.windDir16Point = windDir16Point;
    }

    public int getWindDirDegree() {
        return windDirDegree;
    }

    public void setWindDirDegree(int windDirDegree) {
        this.windDirDegree = windDirDegree;
    }

    public double getWindSpeedKmph() {
        return windSpeedKmph;
    }

    public void setWindSpeedKmph(double windSpeedKmph) {
        this.windSpeedKmph = windSpeedKmph;
    }

    public double getWindspeedMiles() {
        return windspeedMiles;
    }

    public void setWindspeedMiles(double windspeedMiles) {
        this.windspeedMiles = windspeedMiles;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeDoubleArray(
                new double[]{
                        cloudCover,
                        humidity,
                        precipMM,
                        pressure,
                        tempC,
                        tempF,
                        visibility,
                        windSpeedKmph,
                        windspeedMiles});
        parcel.writeStringArray(
                new String[]{
                        weatherDesc,
                        weatherIconUrl,
                        windDir16Point});
        parcel.writeInt(windDirDegree);
    }

    private CurrentWeather(Parcel parcel)
    {
        double[] valuesDouble = new double[9];
        parcel.readDoubleArray(valuesDouble);
        String[] valuesString = new String[3];
        parcel.readStringArray(valuesString);
        windDirDegree = parcel.readInt();
        cloudCover = valuesDouble[0];
        humidity= valuesDouble[1];
        precipMM= valuesDouble[2];
        pressure= valuesDouble[3];
        tempC= valuesDouble[4];
        tempF= valuesDouble[5];
        visibility= valuesDouble[6];
        windSpeedKmph= valuesDouble[7];
        windspeedMiles= valuesDouble[8];
        weatherDesc = valuesString[0];
        weatherIconUrl = valuesString[1];
        windDir16Point = valuesString[2];

    }

    public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
        public CurrentWeather createFromParcel(Parcel parcel) {
            return new CurrentWeather(parcel);
        }

        public CurrentWeather[] newArray(int size) {
            return new CurrentWeather[size];
        }
    };


}
